import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_module/global/colors.dart';
import 'package:flutter_screenutil/screen_util.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        //appBar: AppBar(
        //  backgroundColor: Colors.black26,
        //  title: Text('container'),
        //),
        body: Pay(),
      ),
    );
  }
}
class Pay extends StatefulWidget {
  Pay({Key key}) : super(key: key);

  @override
  _PayState createState() {
    return _PayState();
  }
}

class _PayState extends State<Pay> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  void _loadData() async {
    EasyLoading.show(
      status: "支付中",
      //duration: Duration(seconds: 2)
      //maskType: EasyLoadingMaskType.black,
    );
    await Future.delayed(Duration(milliseconds: 500), () async {
      EasyLoading.showSuccess('支付成功');

    });
    await Future.delayed(Duration(milliseconds: 500), () async {
      Navigator.pushNamed(context, '/');

    });

  }
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(
      BoxConstraints(
          maxWidth: MediaQuery.of(context).size.width,
          maxHeight: MediaQuery.of(context).size.height
      ),
      designSize: Size(1080,2340),
    );
    return Scaffold(
      backgroundColor:Color(0xff000B1F) ,
      appBar: AppBar(
        backgroundColor: Color(0xff000B1F),
        title: Text(
          '付款',
          style:TextStyle(
            color:Colors.white,
          ),
        ),
        centerTitle: true,
        leading: IconButton(
          icon: Icon(Icons.arrow_back,color: Colors.white),
          onPressed: (){
            Navigator.pop(context);
          },
        ),
      ),
      body: Container(
        margin: EdgeInsets.fromLTRB(
          ScreenUtil().setWidth(0),
          ScreenUtil().setHeight(0),
          ScreenUtil().setWidth(0),
          70,
        ),
        padding: EdgeInsets.fromLTRB(
          ScreenUtil().setWidth(30),
          ScreenUtil().setHeight(30),
          ScreenUtil().setWidth(30),
          ScreenUtil().setHeight(0),
        ),
        child: Column(
          children: [
            Container(
              //height: ScreenUtil().setHeight(352),
              padding: EdgeInsets.all(ScreenUtil().setHeight(30)),
              decoration: BoxDecoration(
               // color: Color(0xff182643),
                borderRadius: BorderRadius.all(Radius.circular(8)),
              ),
              child: Center(
                child: Text.rich(
                  TextSpan(
                      children: [
                        TextSpan(
                          text: '1.2',
                          style: TextStyle(
                            color: AppColors.primary,
                            fontSize: ScreenUtil().setSp(55),
                          ),
                        ),
                        TextSpan(
                          text: 'Eth',
                          style: TextStyle(
                            color: AppColors.primary,
                            fontSize: ScreenUtil().setSp(40),
                          ),
                        ),
                      ]
                  ),
                ),
              ),
            ),
            Container(
              margin: EdgeInsets.fromLTRB(
                ScreenUtil().setWidth(0),
                ScreenUtil().setHeight(30),
                ScreenUtil().setWidth(0),
                ScreenUtil().setHeight(0),
              ),
              height: ScreenUtil().setHeight(600),
              width: ScreenUtil().screenWidth-ScreenUtil().setWidth(60),
              padding: EdgeInsets.all(ScreenUtil().setHeight(30)),
              decoration: BoxDecoration(
                color: Color(0xff182643),
                borderRadius: BorderRadius.all(Radius.circular(8)),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    '支付方式',
                    style:TextStyle(
                      fontSize: ScreenUtil().setSp(35),
                      color:Colors.white,
                    ),
                  ),
                  Divider(color: Color(0xff000B1F),height: 5,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Row(
                        children: [
                          Image.asset(
                            'assets/images/weixin.png',
                            height: ScreenUtil().setHeight(74),
                            fit: BoxFit.fitHeight,
                          ),
                          SizedBox(width: ScreenUtil().setWidth(30),),
                          Text(
                            '微信支付',
                            style:TextStyle(
                              fontSize: ScreenUtil().setSp(45),
                              color:Colors.white,
                            ),
                          ),
                        ],
                      ),
                      Image.asset(
                        'assets/images/unselect.png',
                        width: ScreenUtil().setHeight(65),
                        height: ScreenUtil().setHeight(65),
                        fit: BoxFit.fitHeight,
                      ),
                    ],
                  ),
                  Divider(color: Color(0xff000B1F),height: 5,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Row(
                        children: [
                          Image.asset(
                            'assets/images/zhifubao.png',
                            height: ScreenUtil().setHeight(74),
                            fit: BoxFit.fitHeight,
                          ),
                          SizedBox(width: ScreenUtil().setWidth(30),),
                          Text(
                            '支付宝支付',
                            style:TextStyle(
                              fontSize: ScreenUtil().setSp(45),
                              color:Colors.white,
                            ),
                          ),
                        ],
                      ),
                      Image.asset(
                        'assets/images/unselect.png',
                        width: ScreenUtil().setHeight(65),
                        height: ScreenUtil().setHeight(65),
                        fit: BoxFit.fitHeight,
                      ),
                    ],
                  ),
                  Divider(color: Color(0xff000B1F),height: 5,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Row(
                        children: [
                          Image.asset(
                            'assets/images/zhanghu.png',
                            height: ScreenUtil().setHeight(74),
                            fit: BoxFit.fitHeight,
                          ),
                          SizedBox(width: ScreenUtil().setWidth(30),),
                          Text(
                            '账户支付',
                            style:TextStyle(
                              fontSize: ScreenUtil().setSp(45),
                              color:Colors.white,
                            ),
                          ),
                        ],
                      ),
                      Image.asset(
                        'assets/images/select.png',
                        width: ScreenUtil().setHeight(65),
                        height: ScreenUtil().setHeight(65),
                        fit: BoxFit.fitHeight,
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
      bottomSheet: Container(
        height: 70,
        padding: EdgeInsets.fromLTRB(
          ScreenUtil().setWidth(50),
          ScreenUtil().setHeight(0),
          ScreenUtil().setWidth(50),
          ScreenUtil().setHeight(0),
        ),
        color: Color(0xff000B1F),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            InkWell(
              onTap: (){
                _loadData();
              },
              child: Container(
                width: ScreenUtil().setWidth(900),
                height: ScreenUtil().setHeight(122),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(30)),
                  color: AppColors.primary,
                ),
                child: Center(
                  child: Text(
                    '去付款',
                    style:TextStyle(
                      fontSize: ScreenUtil().setSp(50),
                      color:Colors.white,
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}